import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import ErrorPage from '../views/errorpage/errorPage.vue'
import InHospitalInfo from '../views/inHospitalInfo/inHospitalInfo.vue'
import test1 from '../views/test/test1.vue'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children:[
      {
        path: '/test1',
        name: 'test1',
        component: test1,
      }
    ]
  },
  {
    path: '/ErrorPage',
    name: 'ErrorPage',
    component: ErrorPage
  },
  {
    path: '/InHospitalInfo',
    name: 'InHospitalInfo',
    component: InHospitalInfo
  },
  // 错误页面路由
  {
    path: '**',
    // 重定向到错误页面
    name:'ErrorPage',
    component:ErrorPage
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
